<template>
  <div class="app-container">
    <el-card>
      <!--工具栏-->
      <div class="head-container">
        <!-- <eHeader :permission="permission"/>-->
         <crudOperation :permission="permission" />
       </div>
       <!--工具栏-->

      <!--表单组件-->

      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="name" label="名称"/>
        <el-table-column prop="city" label="工作地点"/>
        <el-table-column prop="quantity" label="薪资">
          <template slot-scope="scope">
            <el-button type="primary" size="mini">{{scope.row.salaryDown}}k</el-button>-
            <el-button type="primary" size="mini">{{scope.row.salaryUp}}k</el-button>
          </template>
        </el-table-column>
        <el-table-column prop="quantity" label="招聘人数" />
        <el-table-column  label="操作" width="150px" align="center">
            <template slot-scope="scope">
              <udOperation
                :data="scope.row"
                :permission="permission"
              />
            </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </el-card>

    <!--<el-dialog
      append-to-body
      :close-on-click-modal="false"
      :before-close="crud.cancelCU"
      :visible="crud.status.cu > 0"
      :title="crud.status.title"
      width="500px"
    >
      <el-form
        ref="form"
        :model="form"
        size="small"
        label-width="80px"
      >

        <el-form-item
          label="学员"
          prop="studentId"
        >
          <el-select v-model="form.studentId" style="width: 178px" placeholder="请先选择学员">
            <el-option
              v-for="(item, index) in studentList"
              :key="item.nickname + index"
              :label="item.nickname"
              :value="item.id"
            />
          </el-select>
        </el-form-item>

        <el-form-item
          label="成绩"
          prop="results"
        >
          <el-input v-model="form.results" style="width: 370px;"/>
        </el-form-item>


        <el-form-item label="科目">
          <el-radio-group v-model="form.course" style="width: 178px">
            <el-radio :label="1">科目一</el-radio>
            <el-radio :label="2">科目二</el-radio>
            <el-radio :label="3">科目三</el-radio>
            <el-radio :label="4">科目四</el-radio>
          </el-radio-group>
        </el-form-item>

      </el-form>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="text"
          @click="crud.cancelCU"
        >
          取消
        </el-button>
        <el-button
          :loading="crud.cu === 2"
          type="primary"
          @click="crud.submitCU"
        >
          确认
        </el-button>
      </div>
    </el-dialog>-->

  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import crudJobCollect from '@/api/ceamJobCollect'
import eHeader from './header'
import CRUD, { presenter} from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import udOperation from '@crud/UD.operation'

// crud交由presenter持有
const crud = CRUD({
  title: '职位收藏',
  url: 'api/jobCollect',
  sort: ['sort,asc', 'id,desc'],
  crudMethod: { ...crudJobCollect }
})

export default {
  components: { eHeader, crudOperation, pagination, udOperation },
  mixins: [presenter(crud)],
  data() {
    return {
      delLoading: false,
      studentList: [],
      permission: {
        add: ['admin', 'results:add'],
        edit: ['admin', 'results:edit'],
        del: ['admin', 'collect:del']
      }
    }
  },
  created() {
    this.$nextTick(() => {
      //this.init()
    })
  },
  methods: {
    checkPermission
  }
}
</script>

<style scoped>

</style>
